<?php
namespace app\user\validate;
use think\Validate;
class User extends Validate {
    //验证字段
    protected $rule = [
        'id' => ['require','number'],
        'account_id' => ['require','number'],
    ];
    //返回消息
    protected $message = [
        'require' => '必须',
        'number' => '不是数字',
    ];

    // except_id 场景
    public function sceneExcept_id(){
        return $this->only(['openid','avatarUrl','nickName','gender','country','city','province','language','merchantID','createTime','status','phone']);
    }

    // only_id 场景
    public function sceneOnly_id(){
        return $this->only(['id']);
    }

    // all_field 场景
    public function sceneAll_field(){
        return $this->only(['id','openid','avatarUrl','nickName','gender','country','city','province','language','merchantID','createTime','status','phone']);
    }
    // info 场景
    public function sceneInfo(){
        return $this->only(['account_id']);
    }
}
